﻿#include "mediaserver.h"

MediaServer::MediaServer(QObject *parent)
{

}

MediaServer &MediaServer::getInstance()
{
    static MediaServer me;
    return me;
}

void MediaServer::incomingConnection(qintptr handle)
{
    MediaSocket* socket = new MediaSocket;
    socket->setSocketDescriptor(handle);
    socklist.append(socket);
}

void MediaServer::tranData(QByteArray ba, QString id)
{
    for(auto x:socklist)
    {
        if(x->getId()==id)
        {
            x->write(ba);
            break;
        }
    }
}
